PIDS=`ps -ef | grep extract.document.DocIncreRun | grep -v grep | awk '{print $2}'`
for p in $PIDS; do
    echo "killing $p"
    sudo kill -9 "$p"
done


mkdir -p '../logs'

CUR_TIME=`date +%Y-%m-%d.%H:%M:%S`
LOG_FILE="../logs/document_incre.log.$CUR_TIME"
echo $LOG_FILE

JAVA=`which java`
JAVA="/usr/java/jdk1.8.0_60/bin/java"
echo $JAVA

#$JAVA -cp media-extraction.jar extract.document.DocIncreRun  > $LOG_FILE


/usr/bin/nohup $JAVA -cp media-extraction.jar extract.document.DocIncreRun  > $LOG_FILE &





# When there is nohup, crontab doesn't work!
# exec java -cp media-extraction.jar extract.document.DocIncreRun  > $LOG_FILE <&- &

